import { getAllAuthor } from '@/api/role'
import { ref } from 'vue'
import { AllMenuPermission } from './types'

const useGetAllMenuPermission = () => {
  const allMenuPermission = ref<Array<AllMenuPermission>>([])
  const getAllMenuPermissionLoading = ref(false)

  const getAllMenuPermission = async () => {
    getAllMenuPermissionLoading.value = true
    const res = await getAllAuthor()
    allMenuPermission.value = res.data.data.rows
    getAllMenuPermissionLoading.value = false
  }

  return {
    allMenuPermission,
    getAllMenuPermissionLoading,
    getAllMenuPermission,
  }
}

export default useGetAllMenuPermission
